package com.zuorenke.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.vertx.core.json.Json;

import java.io.Serializable;

/**
 * @author Z.R.K
 * @description
 * @create 2019-04-28 09:54:32
 **/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Result<T> implements Serializable {
	
	private static final long serialVersionUID = -4444713437166205428L;
	
	private boolean success = true;
	private String msg = "操作成功";
	private Integer code = 200;
	private String ticket;
	private T data;
	public Result setData(T data) {
		this.data = data;
		return this;
	}
	
	public int getCode() {
		return code;
	}
	
	public Result setCode(Integer code) {
		this.code = code;
		return this;
	}
	
	public String getMsg() {
		return msg;
	}
	
	public Result setMsg(String msg) {
		this.msg = msg;
		return this;
	}
	
	public boolean isSuccess() {
		return success;
	}
	
	public Result setSuccess(boolean success) {
		this.success = success;
		return this;
	}
	
	public String getTicket() {
		return ticket;
	}
	
	public Result setTicket(String ticket) {
		this.ticket = ticket;
		return this;
	}
	
	
	public T getData() {
		return data;
	}
	
	@Override
	public String toString() {
		return Json.encode(this);
	}
	public static Result build() {
		return new Result();
	}
}